package com.jic.manager.impl;

import java.lang.Long;
import java.util.List;

import com.jic.manager.entity.MerchantWeBankCategory;
import com.jic.manager.mapper.MerchantWeBankCategoryMapper;
import com.jic.manager.service.MerchantWeBankCategoryService;
import com.jic.common.base.vo.PageResult;
import com.jic.common.base.vo.Page;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 商户类目信息表
 * @author : 
 * @email : 
 * @since : 2020-11-28 11:09:19
 * @version : v1.0.0
 */
@Service
public class MerchantWeBankCategoryServiceImpl implements MerchantWeBankCategoryService{

    @Autowired
    private MerchantWeBankCategoryMapper merchantWeBankCategoryMapper;

    @Override
    public long insert(MerchantWeBankCategory merchantWeBankCategory) {
        long flag = merchantWeBankCategoryMapper.insert(merchantWeBankCategory);
        return flag;
    }

    @Override
    public long delete(Long id) {
        return merchantWeBankCategoryMapper.delete(id);
    }

    @Override
    public long update(MerchantWeBankCategory merchantWeBankCategory) {
        return merchantWeBankCategoryMapper.update(merchantWeBankCategory);
    }

    @Override
    public MerchantWeBankCategory queryByPrimaryKey(Long id){
        return merchantWeBankCategoryMapper.queryByPrimaryKey(id);
    }

    @Override
    public List<MerchantWeBankCategory> query(MerchantWeBankCategory merchantWeBankCategory){
        return merchantWeBankCategoryMapper.query(merchantWeBankCategory);
    }

    @Override
    public PageResult<MerchantWeBankCategory> queryPage(MerchantWeBankCategory merchantWeBankCategory, Page pageQuery) {
        //计算下标
        int startIndex = (pageQuery.getStart() - 1) * pageQuery.getLimit();
        List<MerchantWeBankCategory> list = merchantWeBankCategoryMapper.queryPage(startIndex, pageQuery.getLimit(), merchantWeBankCategory);
        long count = merchantWeBankCategoryMapper.queryPageCount(merchantWeBankCategory);
        PageResult pageResult = new PageResult();
        pageResult.setRows(list);
        pageResult.setTotal(count);
        return pageResult;
    }
}